package com.example.spring_test2.dao;

import com.example.spring_test2.domain.Order;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Mapper
public interface orderDao {
    @Insert("insert into order1 (id,product_id,quantity,total_price,status,order_date) values(#{id},#{productId},#{quantity},#{totalPrice},#{status},#{orderDate})")
    public void addOrder(Order order);

    @Update("update order1 set status=#{status},order_date=now() where id=#{id}")
    public void upadteOrder(String status,long id);

    @Select("select * from order1 where id=#{id}")
    public Order getOrderById(long id);
}
//    private Long id;
//    private Long productId;
//    private Integer quantity;
//    private Double totalPrice;
//    private String status;
//    private Date orderDate;